home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH3
/
SRC
/
DEVINFO.FRM
< prev
next >
Wrap
Text File
|
1996-01-09
|
11KB
|
286 lines
VERSION 4.00
Begin VB.Form DevInfoForm
Caption = "DevInfo"
ClientHeight = 3630
ClientLeft = 1320
ClientTop = 1320
ClientWidth = 5055
Height = 4320
Left = 1260
LinkTopic = "PalInfo"
ScaleHeight = 242
ScaleMode = 3 'Pixel
ScaleWidth = 337
Top = 690
Width = 5175
Begin VB.TextBox InfoText
Height = 3615
Left = 0
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 0
Width = 5055
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "DevInfoForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Dim txt As String
Dim sys_pal_size As Integer
Dim num_static As Integer
Dim clrres As Integer
Dim rascaps As Integer
Dim curves As Integer
Dim lines As Integer
Dim poly As Integer
Dim text As Integer
' Get the device type.
txt = "This device is a "
Select Case GetDeviceCaps(hDC, TECHNOLOGY)
Case DT_PLOTTER
txt = txt & "vector plotter"
Case DT_RASDISPLAY
txt = txt & "raster display"
Case DT_RASPRINTER
txt = txt & "raster printer"
Case DT_RASCAMERA
txt = txt & "raster camera"
Case DT_CHARSTREAM
txt = txt & "character-stream, PLP"
Case DT_METAFILE
txt = txt & "metafile, VDM"
Case DT_DISPFILE
txt = txt & "display-file"
End Select
txt = txt & "." & vbCrLf
' Get the display size in millimeters.
txt = txt & "The display is" & _
Str$(GetDeviceCaps(hDC, HORZSIZE)) & "x" & _
Format$(GetDeviceCaps(hDC, VERTSIZE))
' Get the display size in pixels.
txt = txt & " millimeters or" & _
Str$(GetDeviceCaps(hDC, HORZRES)) & "x" & _
Format$(GetDeviceCaps(hDC, VERTRES)) & _
" pixels." & vbCrLf
' Get logical pixels per inch.
txt = txt & "Horizontal pixels per inch:" & _
Str$(GetDeviceCaps(hDC, LOGPIXELSX)) & _
vbCrLf
txt = txt & "Vertical pixels per inch:" & _
Str$(GetDeviceCaps(hDC, LOGPIXELSY)) & _
vbCrLf
' Get color and tool information.
txt = txt & "Bits per pixel:" & _
Str$(GetDeviceCaps(hDC, BITSPIXEL)) & _
"." & vbCrLf
txt = txt & "Color planes:" & _
Str$(GetDeviceCaps(hDC, PLANES)) & _
"." & vbCrLf
txt = txt & "Device brushes:" & _
Str$(GetDeviceCaps(hDC, NUMBRUSHES)) & _
"." & vbCrLf
txt = txt & "Device colors:" & _
Str$(GetDeviceCaps(hDC, NUMCOLORS)) & _
"." & vbCrLf
txt = txt & "Device fonts:" & _
Str$(GetDeviceCaps(hDC, NUMFONTS)) & _
"." & vbCrLf
txt = txt & "Device markers:" & _
Str$(GetDeviceCaps(hDC, NUMMARKERS)) & _
"." & vbCrLf
txt = txt & "Device pens:" & _
Str$(GetDeviceCaps(hDC, NUMPENS)) & _
"." & vbCrLf
' See if the screen supports palettes.
rascaps = GetDeviceCaps(hDC, RASTERCAPS)
If rascaps And RC_PALETTE Then
txt = txt & "This device supports palettes." & vbCrLf
' See how big the system palette is.
sys_pal_size = GetDeviceCaps(hDC, SIZEPALETTE)
txt = txt & "The system palette holds" & _
Str$(sys_pal_size) & " entries." & _
vbCrLf
' See how many static colors there are.
num_static = GetDeviceCaps(hDC, NUMRESERVED)
txt = txt & "There are" & Str$(num_static) & _
" static colors." & vbCrLf
' Give the indexes of the static colors.
txt = txt & "The static colors are in system palette entries: 0-" & _
Format$(num_static \ 2 - 1) & " and " & _
Format$(sys_pal_size - num_static \ 2) & _
"-" & Format$(sys_pal_size - 1) & _
"." & vbCrLf
' Get the color resolution.
clrres = GetDeviceCaps(hDC, COLORRES)
txt = txt & "The color resolution is" & _
Str$(clrres) & " bits per pixel (" & _
Format$(2 ^ clrres) & _
" possible values)." & vbCrLf
' Get RASTERCAPS values.
txt = txt & "This device supports the following raster features:" & _
vbCrLf
If rascaps And RC_BANDING Then _
txt = txt & " Banding." & vbCrLf
If rascaps And RC_BIGFONT Then _
txt = txt & " Fonts bigger than 64K." & vbCrLf
If rascaps And RC_BITBLT Then _
txt = txt & " Bitmap transfer." & vbCrLf
If rascaps And RC_BITMAP64 Then _
txt = txt & " Bitmaps bigger than 64K." & vbCrLf
If rascaps And RC_DI_BITMAP Then _
txt = txt & " The SetDIBits and GetDIBits functions." & vbCrLf
If rascaps And RC_DIBTODEV Then _
txt = txt & " The SetDIBitsToDevice function." & vbCrLf
If rascaps And RC_FLOODFILL Then _
txt = txt & " Flood fills." & vbCrLf
If rascaps And RC_GDI20_OUTPUT Then _
txt = txt & " Windows 2.0 features." & vbCrLf
If rascaps And RC_PALETTE Then _
txt = txt & " Palettes." & vbCrLf
If rascaps And RC_SCALING Then _
txt = txt & " Scaling." & vbCrLf
If rascaps And RC_STRETCHBLT Then _
txt = txt & " The StretchBlt function." & vbCrLf
If rascaps And RC_STRETCHDIB Then _
txt = txt & " The StretchDIBits function." & vbCrLf
' Get CURVECAPS values.
curves = GetDeviceCaps(hDC, CURVECAPS)
txt = txt & "This device supports the following curve features:" & _
vbCrLf
If curves And CC_CHORD Then _
txt = txt & " Chords." & vbCrLf
If curves And CC_CIRCLES Then _
txt = txt & " Circles." & vbCrLf
If curves And CC_ELLIPSES Then _
txt = txt & " Ellipses." & vbCrLf
If curves And CC_INTERIORS Then _
txt = txt & " Interiors." & vbCrLf
If curves And CC_PIE Then _
txt = txt & " Pie slices." & vbCrLf
If curves And CC_STYLED Then _
txt = txt & " Line styles." & vbCrLf
If curves And CC_WIDE Then _
txt = txt & " Wide lines." & vbCrLf
If curves And CC_WIDESTYLED Then _
txt = txt & " Wide styled lines." & vbCrLf
' Get LINECAPS values.
lines = GetDeviceCaps(hDC, LINECAPS)
txt = txt & "This device supports the following line features:" & _
vbCrLf
If lines And LC_INTERIORS Then _
txt = txt & " Interiors." & vbCrLf
If lines And LC_MARKER Then _
txt = txt & " Markers." & vbCrLf
If lines And LC_POLYLINE Then _
txt = txt & " Polyline." & vbCrLf
If lines And LC_POLYMARKER Then _
txt = txt & " Polymarkers." & vbCrLf
If lines And LC_STYLED Then _
txt = txt & " Styled lines." & vbCrLf
If lines And LC_WIDE Then _
txt = txt & " Wide lines." & vbCrLf
If lines And LC_WIDESTYLED Then _
txt = txt & " Wide styled lines." & vbCrLf
' Get POLYGONALCAPS values.
poly = GetDeviceCaps(hDC, POLYGONALCAPS)
txt = txt & "This device supports the following polygon features:" & _
vbCrLf
If lines And PC_INTERIORS Then _
txt = txt & " Interiors." & vbCrLf
If lines And PC_POLYGON Then _
txt = txt & " Alternate filled polygons." & vbCrLf
If lines And PC_RECTANGLE Then _
txt = txt & " Rectangles." & vbCrLf
If lines And PC_SCANLINE Then _
txt = txt & " Scan lines." & vbCrLf
If lines And PC_STYLED Then _
txt = txt & " Styled borders." & vbCrLf
If lines And PC_WIDE Then _
txt = txt & " Wide borders." & vbCrLf
If lines And PC_WIDESTYLED Then _
txt = txt & " Wide styled borders." & vbCrLf
If lines And PC_WINDPOLYGON Then _
txt = txt & " Winding number filled polygons." & vbCrLf
' Get TEXTCAPS values.
text = GetDeviceCaps(hDC, TEXTCAPS)
txt = txt & "This device supports the following text features:" & _
vbCrLf
If lines And TC_CP_STROKE Then _
txt = txt & " Stroke clip precision." & vbCrLf
If lines And TC_CR_90 Then _
txt = txt & " Characters rotated 90 degrees." & vbCrLf
If lines And TC_CR_ANY Then _
txt = txt & " Characters rotated through any angle." & vbCrLf
If lines And TC_EA_DOUBLE Then _
txt = txt & " Double weight fonts (bold)." & vbCrLf
If lines And TC_IA_ABLE Then _
txt = txt & " Italics." & vbCrLf
If lines And TC_OP_CHARACTER Then _
txt = txt & " Character output precision." & vbCrLf
If lines And TC_OP_STROKE Then _
txt = txt & " Stroke output precision." & vbCrLf
If lines And TC_RA_ABLE Then _
txt = txt & " Raster fonts." & vbCrLf
If lines And TC_SA_CONTIN Then _
txt = txt & " Fonts scaled by any factor." & vbCrLf
If lines And TC_SA_DOUBLE Then _
txt = txt & " Font scaled by a factor of 2." & vbCrLf
If lines And TC_SA_INTEGER Then _
txt = txt & " Fonts scaled by integer multiples." & vbCrLf
If lines And TC_SF_X_YINDEP Then _
txt = txt & " Fonts scaled in the X and Y directions independently." & vbCrLf
If lines And TC_SO_ABLE Then _
txt = txt & " Strikeout." & vbCrLf
If lines And TC_UA_ABLE Then _
txt = txt & " Underline." & vbCrLf
If lines And TC_VA_ABLE Then _
txt = txt & " Vector fonts." & vbCrLf
Else
txt = txt & "This device does not support palettes." & vbCrLf
End If
InfoText.text = txt
End Sub
' ***********************************************
' Make the text box as large as possible.
' ***********************************************
Private Sub Form_Resize()
If WindowState = vbMinimized Then Exit Sub
InfoText.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub